#include<iostream>
using namespace std;
const int N = 1e5 + 10, M = 31 * N;
int s[M][2];
int arr[N];
int n, idx;
void insert(int x)
{
	int p = 0;
	for (int i = 30; i >= 0; i--) {
		int t = (x >> i) & 1;
		if (!s[p][t]) {
			s[p][t] = ++idx;
		}
		p = s[p][t];
	}
}	
int find(int x)
{
	int p = 0;
	int ans = 0;
	for (int i = 30; i >= 0; i--) {
		int t = (x >> i) & 1;
		if (s[p][!t]) {
			ans = ans * 2 + !t;
			p = s[p][!t];
		}
		else {
			ans = ans * 2 + t;
			p = s[p][t];
		}
	}
	return ans;
}
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		insert(arr[i]);
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int ret = find(arr[i]);
		ans = max(ans, ret ^ arr[i]);
	}
	cout << ans << endl;
	return 0;
}